<?php
if (!defined("_ECRIRE_INC_VERSION")) return;
include_spip('functions/pdk_common');

/**
 *  Charging function
 */ 
function formulaires_ecatalogue_product_excel_upload_charger_dist(){
	$valeurs = array();
	
	$valeurs['primary_key'] = ''; 
    $valeurs['create_new'] = '';
	
	return $valeurs;
}

/**
 *  Validation function
 */
function formulaires_ecatalogue_product_excel_upload_verifier_dist(){
	$erreurs = array();
	return $erreurs;
}

/**
 *  Processing function
 */
function formulaires_ecatalogue_product_excel_upload_traiter_dist() { 
    $result = array();    
    try {        
        $prd_ex = pdk_load_class('ProductExcel','classes');    
        $prd_ex->UpdateExcel(_request('primary_key'), (bool)_request('create_new'));
        $result['message_ok'] = _T('ecatalogue:excel_products_updated');
    } catch (Exception $e) {
        $exception_message = $e->getMessage();
        $result['message_erreur'] = $exception_message ? $exception_message : _T('ecatalogue:form_error');
    }
    return $result;    
}

?>